import React from "react";
import './index.less'

export default (width=800, height=600) => (WrappedComponent) => {
  return class extends React.Component {
    state = {
      showDialog: false
    }

    closeSubscribeModal = () => {
      this.setState({ showDialog: false })
    }

    render() {
      const { showDialog } = this.props
      return (
        showDialog && <div className="dialog-container"
          style={{ width, height }}
        >
          <div className="dialog">
            <span onClick={this.closeSubscribeModal} className="close"></span>
            <WrappedComponent showDialog={showDialog} />
          </div>
          <div className="mask"></div>
        </div>
      )
    }
  }
}